#pragma once

#include <base/atmoic_hash_map.h>
#include <common/macros.h>
#include <string>
#include <config/cmw_conf.h>

class GlobalData {
    public:
     ~GlobalData();

    void SetProcessGroup(const std::string& process_group);
    const std::string& ProcessGroup() const;
    
    const CmwConfig& Config() const;
    static uint64_t GenerateHashId(const std::string& name) {
        return Hash(name);
    }
    static uint64_t RegisterTaskName(const std::string& task_name);
    static std::string GetTaskNameById(uint64_t id);

    private:
    bool InitConfig();

    //当前进程的信息
    int porcess_id_;
    std::string process_group_;
    // global config
    CmwConfig config_;
    static AtomicHashMap<uint64_t, std::string, 256> task_id_map_;
    //GlobalData为全局单例
    DECLARE_SINGLETON(GlobalData)
};